<ui:composition template="/WEB-INF/templates/login-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="menu"></ui:define>
	<ui:define name="submenu"></ui:define>
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">		
	
	<h:form  id="scheduleform" > 
	<p:growl/>
	 <h:outputText value="Schedule Interview Date[Time]" styleClass="outputTextTitle" rendered="#{scheduleInterviewsBean.activity eq 'ScheduleByRecruiter' or (scheduleInterviewsBean.activity eq 'ScheduleByInterviewer1') or (scheduleInterviewsBean.activity eq 'ScheduleByInterviewer2') or (scheduleInterviewsBean.activity eq 'FinalizeScheduleTimes2') or (scheduleInterviewsBean.activity eq 'FinalizeScheduleTimes')}"/>	
	 <h:outputText value="Approve Candidates to Hire" styleClass="outputTextTitle" rendered="#{scheduleInterviewsBean.activity eq 'approvedByHigherAuthority' }"/>	
	 <h:outputText value="Generate Offer Letter" styleClass="outputTextTitle" rendered="#{scheduleInterviewsBean.activity  eq 'releaseOfferLetter' }"/>
	 <h:outputText value="Create Feedback" styleClass="outputTextTitle" rendered="#{scheduleInterviewsBean.activity  eq 'CreateFeedBack' }"/>
	 <h:outputText value="View Feedback" styleClass="outputTextTitle" rendered="#{scheduleInterviewsBean.activity  eq 'CreateManagerRecommendations' }"/>
	 <h:outputText value="Approver Recommendations" styleClass="outputTextTitle" rendered="#{scheduleInterviewsBean.activity  eq 'approvealRecommendation' }"/>
	
	  <h:panelGrid style="width: 80%" id="rrfsPanel">
	  
	  <p:scrollPanel style="width:830px;height:490px" mode="native">   
	  	<p:dataTable value="#{scheduleInterviewsBean.recruitmentProfiles}" var="profile" id="profilesList">
					
			<p:column headerText="S.No">
						<h:outputText value="#{profile.sno}" />
			</p:column>
			<p:column headerText="Candidate Name">
				<h:outputText value="#{profile.candidateName}" />
			</p:column>
			<p:column headerText="View Resumes">  
                <p:commandLink  value="View Profile" actionListener="#{scheduleInterviewsBean.fileDownload}" 
									ajax="false" update="@form" styleClass="downloadResumeCommandLink" style="color:blue;" title="Click to Download Resume">
				  <f:param name="candidateEmail" value="#{profile.candidateEmail}" />
				  <p:fileDownload value="#{scheduleInterviewsBean.file}"></p:fileDownload>
				</p:commandLink>
		    </p:column>
			<p:column headerText="Candidate Email">
				<h:outputText value="#{profile.candidateEmail}" />
			</p:column>
			<p:column headerText="Contact No">
				<h:outputText value="#{profile.candidateMobileNumber}" />
			</p:column>
			<p:column headerText="Location">
				<h:outputText value="#{profile.candidateCurrentLocation}" />
			</p:column>
			<p:column headerText="Source">
				<h:outputText value="#{profile.recruitmentVendor.vendorName}"/>
			</p:column>	
			
			<p:column headerText="Shortlist Remarks">
				<h:outputText value="#{profile.managerShortListRemarks}"/>
			</p:column>	
							
			<p:column headerText="Interview Mode" rendered="#{scheduleInterviewsBean.activity eq 'ScheduleByRecruiter'}">
				<p:selectOneMenu value="#{profile.interviewMode}" >
					<f:selectItems value="#{scheduleInterviewsBean.interviewModeMap}" />
	   			</p:selectOneMenu> 
			</p:column>
			
			<p:column headerText="View FeedBack" rendered="#{scheduleInterviewsBean.activity eq 'CreateManagerRecommendations' or (scheduleInterviewsBean.activity  eq 'approvedByHigherAuthority') or (scheduleInterviewsBean.activity  eq 'releaseOfferLetter') or (scheduleInterviewsBean.activity eq 'ScheduleByRecruiter')}">
				 <p:commandButton value="View"  actionListener="#{scheduleInterviewsBean.viewFeedbackAction}">
					 <f:param id="rrfCode1" name="rrfCode1" value="#{profile.recruitmentRequestCode}" />
					 <f:param id="candidateEmail1" name="candidateEmail1" value="#{profile.candidateEmail}" />
				 </p:commandButton>
			</p:column> 
			
			<p:column headerText="Recruiter Schedule Date[Time] " rendered="#{scheduleInterviewsBean.activity eq 'ScheduleByRecruiter' or (scheduleInterviewsBean.activity  eq 'FinalizeScheduleTimes') or (scheduleInterviewsBean.activity  eq 'ScheduleByInterviewer1') or (scheduleInterviewsBean.activity  eq 'ScheduleByInterviewer2') or (scheduleInterviewsBean.activity  eq 'FinalizeScheduleTimes2')}">
				<p:calendar id="recruiterScheduleTime"  value="#{profile.recruiterScheduleTime}" pattern="dd-MMM-yyyy HH:mm a" size="27" disabled="#{scheduleInterviewsBean.disableRecruiterDate}" />
			</p:column>
			
			<p:column headerText="Interviewer1 Schedule Date[Time] " rendered="#{scheduleInterviewsBean.activity eq 'ScheduleByInterviewer1' or (scheduleInterviewsBean.recruitmentRequest.interviewerFBLevel  eq 'Level1' and scheduleInterviewsBean.activity eq 'FinalizeScheduleTimes' )}">
				<p:calendar value="#{profile.interviewer1ScheduleTime}" pattern="dd-MMM-yyyy HH:mm a" disabled="#{scheduleInterviewsBean.disableInterviewer1Date}"/>
			</p:column>
			
			<p:column headerText="Interviewer2 Schedule Date[Time] " rendered="#{scheduleInterviewsBean.activity eq 'ScheduleByInterviewer2' or (scheduleInterviewsBean.recruitmentRequest.interviewerFBLevel  eq 'Level2' and scheduleInterviewsBean.activity eq 'FinalizeScheduleTimes' ) or (scheduleInterviewsBean.activity  eq 'FinalizeScheduleTimes2')}">
						<p:calendar value="#{profile.interviewer2ScheduleTime}" pattern="dd-MMM-yyyy HH:mm a" disabled="#{scheduleInterviewsBean.disableInterviewer2Date}" />
			</p:column>
			
			<p:column headerText="Interview Held On" rendered="#{scheduleInterviewsBean.activity eq 'CreateFeedBack' or (scheduleInterviewsBean.activity  eq 'CreateManagerRecommendations') or (scheduleInterviewsBean.activity  eq 'approvedByHigherAuthority') or (scheduleInterviewsBean.activity  eq 'releaseOfferLetter')}">
				<h:outputText value="#{profile.finalInterviewDates}"  >
					<f:convertDateTime pattern="dd-MMM-yyyy HH:mm a" timeZone="#{scheduleInterviewsBean.timeZone}" />
				</h:outputText>
			</p:column>
					<!-- <p:column headerText="Interviewer2 Schedule Date[Time] " rendered="#{scheduleInterviewsBean.activity eq 'ScheduleByInterviewer1' }">
						<p:calendar value="#{profile.interviewer2ScheduleTime}" pattern="MM/dd/yyyy HH:mm a" />
					</p:column> -->
			<p:column headerText="Interviewer1 FB Status" rendered="#{scheduleInterviewsBean.activity eq 'CreateManagerRecommendations' or (scheduleInterviewsBean.activity  eq 'CreateFeedBack')}">
				<h:outputLabel value="#{profile.interviewer1FeedbackStatus}" />
			</p:column>
			
			<p:column headerText="Interviewer2 FB Status" rendered="#{scheduleInterviewsBean.activity eq 'CreateManagerRecommendations' or (scheduleInterviewsBean.activity  eq 'CreateFeedBack')}">
				<h:outputLabel value="#{profile.interviewer2FeedbackStatus}" />
			</p:column>
			
			<p:column headerText="Mngr. Recommendation Status" rendered="#{scheduleInterviewsBean.activity eq 'CreateManagerRecommendations' or (scheduleInterviewsBean.activity  eq 'approvedByHigherAuthority')}">
				<h:outputLabel value="#{profile.managerRecommendationStatus}" />
			</p:column>
		  
		    <p:column headerText="Create FeedBack" rendered="#{scheduleInterviewsBean.activity eq 'CreateFeedBack'}">
				 <p:commandButton value="Create" action="#{scheduleInterviewsBean.createFeedbackAction}" disabled="#{profile.disableCreateFeedBack}">
					 <f:param id="rrfCode" name="rrfCode" value="#{scheduleInterviewsBean.recruitmentRequest.recruitmentRequestCode}" />
					 <f:param id="candidateEmail" name="candidateEmail" value="#{profile.candidateEmail}" />
				 </p:commandButton>
			</p:column>			
			
			
					<p:column headerText="Approve to Hire" rendered="#{scheduleInterviewsBean.activity eq 'approvedByHigherAuthority' }">
						<p:selectOneMenu value="#{profile.approverFeedbackStatus}" style="width:150px;">
			           		<f:selectItem itemLabel="On Hold" itemValue="On Hold" />	
			           		<f:selectItem itemLabel="Approved" itemValue="Approved" />
							<f:selectItem itemLabel="Not Approved" itemValue="Not Approved" />													
					    </p:selectOneMenu>  
					</p:column>
					<p:column headerText="Approver Remarks" rendered="#{scheduleInterviewsBean.activity eq 'approvedByHigherAuthority'}">
						<p:inputTextarea value="#{profile.approverRemarks}" autoResize="false" rows="2"/>
					</p:column>					
					<p:column headerText="Approver Recommendation" rendered="#{scheduleInterviewsBean.activity eq 'approvealRecommendation'}">
						<h:outputText value="#{profile.approverFeedbackStatus}" />
					</p:column>
					<p:column headerText="Approver Remarks" rendered="#{scheduleInterviewsBean.activity eq 'approvealRecommendation'}">
						<h:outputText value="#{profile.approverRemarks}" />
					</p:column>
					
					<p:column headerText="Date of Joining" rendered="#{scheduleInterviewsBean.activity eq 'approvealRecommendation'}">
						<h:outputText value="#{profile.expectedJoiningDate}"  >
							<f:convertDateTime pattern="dd-MMM-yyyy" />	
						</h:outputText>
					</p:column>
					<p:column headerText="Band" rendered="#{scheduleInterviewsBean.activity eq 'approvealRecommendation'}">
						<h:outputText value="#{profile.band.band}"  />
					</p:column>
					<p:column headerText="Release Offer Letter" rendered="#{scheduleInterviewsBean.activity eq 'approvealRecommendation'}">
						<p:selectOneMenu value="#{profile.releaseOfferLetter}" style="width:100px;">
							<f:selectItems value="#{scheduleInterviewsBean.releaseOfferLetterMap}" />
			   			</p:selectOneMenu> 
					</p:column>
					<p:column headerText="Release OfferLetter" rendered="#{scheduleInterviewsBean.activity  eq 'releaseOfferLetter'}">
						<h:outputText value="#{profile.releaseOfferLetter}" />
					</p:column>
					<p:column headerText="Approver Recommendation" rendered="#{scheduleInterviewsBean.activity  eq 'releaseOfferLetter'}">
						<h:outputText value="#{profile.approverFeedbackStatus}" />
					</p:column>
					<p:column headerText="Generate Offer" rendered="#{scheduleInterviewsBean.activity  eq 'releaseOfferLetter'}">
						 <p:commandButton value="Generate" oncomplete="offerLetterDialog.show()" update="@form" process="@this" 
							actionListener="#{scheduleInterviewsBean.generateOfferLetterListener}" >
							 <f:param id="rrfCode2" name="rrfCode2" value="#{scheduleInterviewsBean.recruitmentRequest.recruitmentRequestCode}" />
							 <f:param id="candidateEmail2" name="candidateEmail2" value="#{profile.candidateEmail}" />
						 </p:commandButton>
					</p:column>
				
					
				</p:dataTable>
		</p:scrollPanel>  
				
				 <h:panelGroup style="float:right;">
				 	<p:commandButton value="Schedule"  actionListener="#{scheduleInterviewsBean.scheduleByRecruiterAction}" update="@form" rendered="#{scheduleInterviewsBean.activity eq 'ScheduleByRecruiter' or (scheduleInterviewsBean.activity  eq 'ScheduleByInterviewer1') or (scheduleInterviewsBean.activity  eq 'FinalizeScheduleTimes') or (scheduleInterviewsBean.activity  eq 'ScheduleByInterviewer2') or (scheduleInterviewsBean.activity  eq 'FinalizeScheduleTimes2')}"/>
				 	<p:commandButton value="Submit to Manager"  actionListener="#{scheduleInterviewsBean.scheduleByRecruiterAction}" update="@form" rendered="#{scheduleInterviewsBean.activity eq 'CreateFeedBack'}"/>
				 	<p:commandButton value="Submit for Approval"  actionListener="#{scheduleInterviewsBean.scheduleByRecruiterAction}" update="@form" rendered="#{scheduleInterviewsBean.activity eq 'CreateManagerRecommendations'}"/>
				 	<p:commandButton value="Submit"  actionListener="#{scheduleInterviewsBean.scheduleByRecruiterAction}" update="@form" rendered="#{scheduleInterviewsBean.activity eq 'approvedByHigherAuthority'}"/>
				 	<p:commandButton value="Submit to HR"  actionListener="#{scheduleInterviewsBean.scheduleByRecruiterAction}" update="@form" rendered="#{scheduleInterviewsBean.activity eq 'approvealRecommendation'}"/>
				    <p:commandButton value="Close" onclick="window.close();" rendered="#{viewRRFByReportingManagerBean.renderCloseButton}" /> 
				    <p:commandButton value="Back" onclick="history.back();"  rendered="#{viewRRFByReportingManagerBean.renderBackButton}" /> 
				 </h:panelGroup>
				
				</h:panelGrid>
				
				<p:dialog hideEffect="fade" showEffect="fade"
				header="Genearte Offer Letter  :   #{scheduleInterviewsBean.recruitmentProfile.candidateName} "
				id="offerLetterDialog" widgetVar="offerLetterDialog" resizable="false"
				modal="true">
				<p:scrollPanel style="width:550px;height:500px" mode="native"> 
				<h:panelGrid columns="3" cellspacing="10">

					   <h:outputLabel value="RRF Code" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{scheduleInterviewsBean.recruitmentProfile.recruitmentRequestCode}" />
			          
			           <h:outputLabel value="Module Name" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{scheduleInterviewsBean.recruitmentProfile.technology}" />
			           
			           <h:outputLabel value="Candidate Name" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{scheduleInterviewsBean.recruitmentProfile.candidateName}" />
			          
			           <h:outputLabel value="Candidate Email" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{scheduleInterviewsBean.recruitmentProfile.candidateEmail}" />           
			           	
					   		           
			           <h:outputLabel value="Generating Offer Letter Date" />
			           <h:outputLabel value=":" />
			           <h:outputText value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.genearatedOfferLetterDate}"  >
							<f:convertDateTime pattern="dd-MMM-yyyy HH:mm a" timeZone="#{scheduleInterviewsBean.timeZone}"/>
					   </h:outputText>
					   
					   <h:outputLabel value="Employee Position" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{scheduleInterviewsBean.recruitmentProfile.band.businessFunction}"   />
			           
			           <h:outputLabel value="Employee Band " />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{scheduleInterviewsBean.recruitmentProfile.band.band}" />  
			           
			           <h:outputLabel value="Employee Gross Salary" />
			           <h:outputLabel value=":" />
			           <h:outputLabel	value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.employeeGrossSalary}" />			           
			           
			           <h:outputLabel value="Gross Salary (In Words) " />
			           <h:outputLabel value=":" />
			           <h:outputLabel  value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.grossSalaryInWords}"  />
			           
			           <h:outputLabel value="Gender" />
			           <h:outputLabel value=":" />
			         	<p:selectOneMenu value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.gender}" style="width:160px;">
							<f:selectItem itemLabel="Male" itemValue="Male" />
							<f:selectItem itemLabel="Female" itemValue="Female" />
					   </p:selectOneMenu>
			          
			           <h:outputLabel value="HR Reference Number" />
			           <h:outputLabel value=":" />
			           <p:inputText value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.hrReferenceNo}" maxlength="10" />
			           
			           <h:outputLabel value="Employee Date of Joining" />
			           <h:outputLabel value=":" />
			           <p:calendar value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.employeeDateOfJoining}"  pattern="dd-MMM-yyyy"/>
			           
			           <h:outputLabel value="HR Signature Name" />
			           <h:outputLabel value=":" />
			           <p:selectOneMenu value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.hrSignatureName}" style="width:160px;">
							<f:selectItems value="#{scheduleInterviewsBean.hrsMap}" />
			           </p:selectOneMenu> 
			           			           
			           <h:outputLabel value="Higher Authority Signature Name" />
			           <h:outputLabel value=":" />
			           <p:inputText value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.approverSignatureName}" />
			           
			           <h:outputLabel value="Higher Authority Signature Position" />
			           <h:outputLabel value=":" />
			           <p:inputText value="#{scheduleInterviewsBean.rrfOfferLetterHRInputs.approverSignaturePosition}"  />
			          
					
				</h:panelGrid>		
				</p:scrollPanel>
				<h:panelGroup style="float:right;">
					<p:commandButton id="submitButton" value="Submit" actionListener="#{scheduleInterviewsBean.createOfferLetterListener}"
							 update="@form">
					</p:commandButton>	
					<p:commandButton id="closeButton" process="@this" value="Close" actionListener="#{scheduleInterviewsBean.dialogClose}" update="@form"/>
				</h:panelGroup>
					
			</p:dialog>	
				
     </h:form>
	</ui:define>
	
</ui:composition>
